<?php 
$count = count($rel);

?>
<DIV id="Slidebox">
<SCRIPT type="text/javascript">
//<![CDATA[
var currentindex=1;
$("#flashBg").css("background-color",$("#flash1").attr("name"));
function changeflash(i) {	
currentindex=i;
for (j=1;j<=<?php echo $count; ?>;j++){//此处的5代表你想要添加的幻灯片的数量与下面的5相呼应
	if (j==i) 
	{$("#flash"+j).fadeIn("normal");
	$("#flash"+j).css("display","block");
	$("#f"+j).removeClass();
	$("#f"+j).addClass("dq");
	$("#flashBg").css("background-color",$("#flash"+j).attr("name"));
	}
	else
	{$("#flash"+j).css("display","none");
	$("#f"+j).removeClass();
	$("#f"+j).addClass("no");}
}}
function startAm(){
timerID = setInterval("timer_tick()",2000);//2000代表间隔时间设置
}
function stopAm(){
clearInterval(timerID);
}
function timer_tick() {
    currentindex=currentindex>=<?php echo $count; ?>?1:currentindex+1;//此处的5代表幻灯片循环遍历的次数
	changeflash(currentindex);}
$(document).ready(function(){
$(".flash_bar div").mouseover(function(){stopAm();}).mouseout(function(){startAm();});
startAm();
});

 //]]>
</SCRIPT>
    <!--flash begin-->
    <DIV id="flashBg">
        <DIV id="flashLine">
            <DIV id="flash">
<?php if(!empty($rel)){
foreach($rel as $k=>$v){
	echo '<a id="flash1" href="'.$v['pic_url'].'" name="#238db8" style="display:block;"><img src="'.CMS_SELF.'upload/'.$v['pic'].'" title="'.$v['pic_text'].'"'; 
?> width="<?php echo isset($rel_info[0]['flash_width'])?$rel_info[0]['flash_width']:950;?>" height="<?php echo isset($rel_info[0]['flash_height'])?$rel_info[0]['flash_height']:200;?>" /></a><?php    
}	
}    
?>                
                <DIV class="flash_bar">
                    <?php
					for ($f = 1; $f <= $count; $f++) { 
                    echo '<DIV id="f'.$f.'" class="dq" onClick="changeflash('.$f.')"></DIV>';
					}
                    ?>
                </DIV>
            </DIV>
        </DIV>
    </DIV>
    <!--flash end-->
</DIV>
